From 21e953c65c410225e27a8ccf36fc19c84f0258ec Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 27 Feb 2010 20:22:56 +0000 Subject: [PATCH] * (bug 22606) The body of e-mail address confirmation message is now different when the address changed --- RELEASE-NOTES | 2 ++ includes/Preferences.php | 2 +- includes/User.php | 6 ++-- languages/messages/MessagesEn.php | 48 ++++++++++++++++++++----------- maintenance/language/messages.inc | 1 + 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1d79a61f67..2238e7bf06 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -27,6 +27,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN throws an error * (bugs 22665 and 22667) User '0' can now be unblocked and have its block settings changed +* (bug 22606) The body of e-mail address confirmation message is now different + when the address changed == API changes in 1.17 == diff --git a/includes/Preferences.php b/includes/Preferences.php index 70d88ec968..daf9309535 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1272,7 +1272,7 @@ class Preferences { if( $wgEmailAuthentication ) { # Mail a temporary password to the dirty address. # User can come back through the confirmation URL to re-enable email. - $result = $wgUser->sendConfirmationMail(); + $result = $wgUser->sendConfirmationMail( $oldadr != '' ); if( WikiError::isError( $result ) ) { return wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) ); } elseif( $entryPoint == 'ui' ) { diff --git a/includes/User.php b/includes/User.php index f09294ffcf..475f976e40 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2908,9 +2908,10 @@ class User { * Generate a new e-mail confirmation token and send a confirmation/invalidation * mail to the user's given address. * + * @param $changed Boolean: whether the adress changed * @return \types{\bool,\type{WikiError}} True on success, a WikiError object on failure. */ - function sendConfirmationMail() { + function sendConfirmationMail( $changed = false ) { global $wgLang; $expiration = null; // gets passed-by-ref and defined in next line. $token = $this->confirmationToken( $expiration ); @@ -2918,8 +2919,9 @@ class User { $invalidateURL = $this->invalidationTokenUrl( $token ); $this->saveSettings(); + $message = $changed ? 'confirmemail_body_changed' : 'confirmemail_body'; return $this->sendMail( wfMsg( 'confirmemail_subject' ), - wfMsg( 'confirmemail_body', + wfMsg( $message, wfGetIP(), $this->getName(), $url, diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 9d55089e84..d77c574d1e 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -3866,31 +3866,31 @@ Others will be hidden by default. 'limitall' => 'all', # E-mail address confirmation -'confirmemail' => 'Confirm e-mail address', -'confirmemail_noemail' => 'You do not have a valid e-mail address set in your [[Special:Preferences|user preferences]].', -'confirmemail_text' => '{{SITENAME}} requires that you validate your e-mail address before using e-mail features. +'confirmemail' => 'Confirm e-mail address', +'confirmemail_noemail' => 'You do not have a valid e-mail address set in your [[Special:Preferences|user preferences]].', +'confirmemail_text' => '{{SITENAME}} requires that you validate your e-mail address before using e-mail features. Activate the button below to send a confirmation mail to your address. The mail will include a link containing a code; load the link in your browser to confirm that your e-mail address is valid.', -'confirmemail_pending' => 'A confirmation code has already been e-mailed to you; +'confirmemail_pending' => 'A confirmation code has already been e-mailed to you; if you recently created your account, you may wish to wait a few minutes for it to arrive before trying to request a new code.', -'confirmemail_send' => 'Mail a confirmation code', -'confirmemail_sent' => 'Confirmation e-mail sent.', -'confirmemail_oncreate' => 'A confirmation code was sent to your e-mail address. +'confirmemail_send' => 'Mail a confirmation code', +'confirmemail_sent' => 'Confirmation e-mail sent.', +'confirmemail_oncreate' => 'A confirmation code was sent to your e-mail address. This code is not required to log in, but you will need to provide it before enabling any e-mail-based features in the wiki.', -'confirmemail_sendfailed' => '{{SITENAME}} could not send your confirmation mail. +'confirmemail_sendfailed' => '{{SITENAME}} could not send your confirmation mail. Please check your e-mail address for invalid characters. Mailer returned: $1', -'confirmemail_invalid' => 'Invalid confirmation code. +'confirmemail_invalid' => 'Invalid confirmation code. The code may have expired.', -'confirmemail_needlogin' => 'You need to $1 to confirm your e-mail address.', -'confirmemail_success' => 'Your e-mail address has been confirmed. +'confirmemail_needlogin' => 'You need to $1 to confirm your e-mail address.', +'confirmemail_success' => 'Your e-mail address has been confirmed. You may now [[Special:UserLogin|log in]] and enjoy the wiki.', -'confirmemail_loggedin' => 'Your e-mail address has now been confirmed.', -'confirmemail_error' => 'Something went wrong saving your confirmation.', -'confirmemail_subject' => '{{SITENAME}} e-mail address confirmation', -'confirmemail_body' => 'Someone, probably you, from IP address $1, +'confirmemail_loggedin' => 'Your e-mail address has now been confirmed.', +'confirmemail_error' => 'Something went wrong saving your confirmation.', +'confirmemail_subject' => '{{SITENAME}} e-mail address confirmation', +'confirmemail_body' => 'Someone, probably you, from IP address $1, has registered an account "$2" with this e-mail address on {{SITENAME}}. To confirm that this account really does belong to you and activate @@ -3904,8 +3904,22 @@ to cancel the e-mail address confirmation: $5 This confirmation code will expire at $4.', -'confirmemail_invalidated' => 'E-mail address confirmation canceled', -'invalidateemail' => 'Cancel e-mail confirmation', +'confirmemail_body_changed' => 'Someone, probably you, from IP address $1, +has changed the e-mail address of the account "$2" to this address on {{SITENAME}}. + +To confirm that this account really does belong to you and reactivate +e-mail features on {{SITENAME}}, open this link in your browser: + +$3 + +If the account does *not* belong to you, follow this link +to cancel the e-mail address confirmation: + +$5 + +This confirmation code will expire at $4.', +'confirmemail_invalidated' => 'E-mail address confirmation canceled', +'invalidateemail' => 'Cancel e-mail confirmation', # Scary transclusion 'scarytranscludedisabled' => '[Interwiki transcluding is disabled]', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 0e39a51b1e..f17953d514 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2858,6 +2858,7 @@ $wgMessageStructure = array( 'confirmemail_error', 'confirmemail_subject', 'confirmemail_body', + 'confirmemail_body_changed', 'confirmemail_invalidated', 'invalidateemail', ), -- 2.20.1